package org.eminem.cloud.registereureakamoviefeignhystrix.controller;

import org.eminem.cloud.registereureakamoviefeignhystrix.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * 作用：
 * ① 测试服务实例的相关内容
 * ② 为后来的服务做提供
 * @author eacdy
 */
@RestController
public class MovieController {


  @Autowired
  private UserFeignClient userFeignClient;



  /**
   * feign 回调
   * 注：@GetMapping("/{id}")是spring 4.3的新注解等价于：
   * @RequestMapping(value = "/id", method = RequestMethod.GET)
   * 类似的注解还有@PostMapping等等
   * @param id
   * @return user信息
   */
  @GetMapping("/user/{id}")
  public User findUserById(@PathVariable Long id) {
    return this.userFeignClient.findById(id);
  }

}
